package fun.tan90.easy.binlog.plugin.common.listener;

import com.github.benmanes.caffeine.cache.RemovalCause;
import com.github.benmanes.caffeine.cache.RemovalListener;
import lombok.extern.slf4j.Slf4j;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;

/**
 * description TODO
 * company 铁人科技
 *
 * @author 陈浩杰
 * @date 2023/9/12 16:49
 */
@Slf4j
public class CaffeineRemovalListener implements RemovalListener<String, Object> {

    private final String outputType;

    public CaffeineRemovalListener(String outputType) {
        this.outputType = outputType;
    }

    @Override
    public void onRemoval(@Nullable String key, @Nullable Object value, @NonNull RemovalCause cause) {
        log.warn("{} removalListener key {} removalCause {}", outputType, key, cause);
    }
}
